﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
    <title>LoginMvc: LoginMvc.fsmcpp Source File</title>
    <link href="/Content/Help.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/tabs.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div id="header">
        <img id="logo" alt="StateForge" src="/Content/Images/StateForgeLogo.png" />
        <div id="title">
            <h1>
                Examples using state machines generated by StateBuilderCpp
            </h1>
            <h3>
                LoginMvc: LoginMvc.fsmcpp Source File
            </h3>
        </div>
        <div id="menucontainer">
            <ul id="menu">
                <li><a href="/">Home</a></li>
                <li><a href="/Home/Download">Downloads</a></li>
                <li><a href="/Help/state-machine-tools.aspx">Help</a></li>
                <li><a href="/Home/Faq">F.A.Q</a></li>
                <li><a href="/Home/About">Contact us</a></li>
            </ul>
        </div>
    </div>
<!-- Generated by Doxygen 1.7.4 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">LoginMvc.fsmcpp</div>  </div>
</div>
<div class="contents">
<a href="_login_mvc_8fsmcpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 &lt;?xml version=<span class="stringliteral">&quot;1.0&quot;</span> encoding=<span class="stringliteral">&quot;UTF-8&quot;</span>?&gt;
<a name="l00002"></a>00002 &lt;sm:StateMachine xmlns:sm=<span class="stringliteral">&quot;http://www.stateforge.com/StateMachineCpp-v1&quot;</span>
<a name="l00003"></a>00003                  xmlns:xsi=<span class="stringliteral">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span>
<a name="l00004"></a>00004                  xsi:schemaLocation=<span class="stringliteral">&quot;http://www.stateforge.com/StateMachineCpp-v1</span>
<a name="l00005"></a>00005 <span class="stringliteral">                                     http://www.stateforge.com/xsd/StateMachineCpp-v1.xsd&quot;</span> &gt;
<a name="l00006"></a>00006 
<a name="l00007"></a>00007   &lt;!-- General settings --&gt;
<a name="l00008"></a>00008   &lt;settings asynchronous=<span class="stringliteral">&quot;true&quot;</span> library=<span class="stringliteral">&quot;qt&quot;</span>&gt;
<a name="l00009"></a>00009     &lt;description&gt;Login Model View Controller&lt;/description&gt;
<a name="l00010"></a>00010     &lt;<span class="keywordtype">object</span> instance=<span class="stringliteral">&quot;loginMvc&quot;</span> <span class="keyword">class</span>=<span class="stringliteral">&quot;LoginMvc&quot;</span> include=<span class="stringliteral">&quot;LoginMvc.h&quot;</span>/&gt;
<a name="l00011"></a>00011     &lt;<span class="keywordtype">object</span> instance=<span class="stringliteral">&quot;view&quot;</span> <span class="keyword">class</span>=<span class="stringliteral">&quot;MyView&quot;</span> include=<span class="stringliteral">&quot;LoginMvc.h&quot;</span>/&gt;
<a name="l00012"></a>00012   &lt;/settings&gt;
<a name="l00013"></a>00013 
<a name="l00014"></a>00014   &lt;!-- Events --&gt;
<a name="l00015"></a>00015   &lt;events&gt;
<a name="l00016"></a>00016     &lt;eventSource name=<span class="stringliteral">&quot;Management&quot;</span>&gt;
<a name="l00017"></a>00017       &lt;<span class="keyword">event</span> <span class="keywordtype">id</span>=<span class="stringliteral">&quot;evStart&quot;</span>/&gt;
<a name="l00018"></a>00018       &lt;<span class="keyword">event</span> <span class="keywordtype">id</span>=<span class="stringliteral">&quot;evStop&quot;</span>/&gt;
<a name="l00019"></a>00019     &lt;/eventSource&gt;
<a name="l00020"></a>00020     &lt;eventSource name=<span class="stringliteral">&quot;View&quot;</span>&gt;
<a name="l00021"></a>00021       &lt;<span class="keyword">event</span> <span class="keywordtype">id</span>=<span class="stringliteral">&quot;evIntentLogin&quot;</span>/&gt;
<a name="l00022"></a>00022       &lt;<span class="keyword">event</span> <span class="keywordtype">id</span>=<span class="stringliteral">&quot;evCancelLogin&quot;</span>/&gt;
<a name="l00023"></a>00023       &lt;<span class="keyword">event</span> <span class="keywordtype">id</span>=<span class="stringliteral">&quot;evIntentContinue&quot;</span>/&gt;
<a name="l00024"></a>00024       &lt;<span class="keyword">event</span> <span class="keywordtype">id</span>=<span class="stringliteral">&quot;evIntentLogout&quot;</span>/&gt;
<a name="l00025"></a>00025     &lt;/eventSource&gt;
<a name="l00026"></a>00026     &lt;eventSource name=<span class="stringliteral">&quot;Model&quot;</span>&gt;
<a name="l00027"></a>00027       &lt;<span class="keyword">event</span> <span class="keywordtype">id</span>=<span class="stringliteral">&quot;evLoginComplete&quot;</span>&gt;
<a name="l00028"></a>00028         &lt;parameter name=<span class="stringliteral">&quot;success&quot;</span> type=<span class="stringliteral">&quot;bool&quot;</span>/&gt;
<a name="l00029"></a>00029       &lt;/<span class="keyword">event</span>&gt;
<a name="l00030"></a>00030     &lt;/eventSource&gt;
<a name="l00031"></a>00031     &lt;eventSource name=<span class="stringliteral">&quot;Timers&quot;</span>&gt;
<a name="l00032"></a>00032       &lt;timer <span class="keywordtype">id</span>=<span class="stringliteral">&quot;evTimerLogin&quot;</span> name=<span class="stringliteral">&quot;TimerLogin&quot;</span>/&gt;
<a name="l00033"></a>00033     &lt;/eventSource&gt;    
<a name="l00034"></a>00034   &lt;/events&gt;
<a name="l00035"></a>00035 
<a name="l00036"></a>00036   &lt;!-- States --&gt;
<a name="l00037"></a>00037   &lt;state name=<span class="stringliteral">&quot;Root&quot;</span>&gt;
<a name="l00038"></a>00038     &lt;!-- transition valid <span class="keywordflow">for</span> all substate --&gt;
<a name="l00039"></a>00039     &lt;transition <span class="keyword">event</span>=<span class="stringliteral">&quot;evStop&quot;</span> nextState=<span class="stringliteral">&quot;End&quot;</span>/&gt;
<a name="l00040"></a>00040     &lt;!-- Initial --&gt;
<a name="l00041"></a>00041     &lt;state name=<span class="stringliteral">&quot;Initial&quot;</span>&gt;
<a name="l00042"></a>00042       &lt;transition <span class="keyword">event</span>=<span class="stringliteral">&quot;evStart&quot;</span> action=<span class="stringliteral">&quot;view.notifyWelcome();&quot;</span> nextState=<span class="stringliteral">&quot;Idle&quot;</span>/&gt;
<a name="l00043"></a>00043     &lt;/state&gt;
<a name="l00044"></a>00044     &lt;!-- Idle --&gt;
<a name="l00045"></a>00045     &lt;state name=<span class="stringliteral">&quot;Idle&quot;</span>&gt;
<a name="l00046"></a>00046       &lt;!-- Idle onEntry --&gt;
<a name="l00047"></a>00047       &lt;onEntry&gt;
<a name="l00048"></a>00048         &lt;action&gt;view.loginButton-&gt;setEnabled(<span class="keyword">true</span>);&lt;/action&gt;
<a name="l00049"></a>00049         &lt;action&gt;view.logoutButton-&gt;setEnabled(<span class="keyword">false</span>);&lt;/action&gt;
<a name="l00050"></a>00050         &lt;action&gt;view.cancelButton-&gt;setEnabled(<span class="keyword">false</span>);&lt;/action&gt;
<a name="l00051"></a>00051       &lt;/onEntry&gt;
<a name="l00052"></a>00052       &lt;!-- Idle transition --&gt;
<a name="l00053"></a>00053       &lt;transition <span class="keyword">event</span>=<span class="stringliteral">&quot;evIntentLogin&quot;</span> nextState=<span class="stringliteral">&quot;TryingToLogin&quot;</span>/&gt;
<a name="l00054"></a>00054     &lt;/state&gt;
<a name="l00055"></a>00055     &lt;!-- TryingToLogin --&gt;
<a name="l00056"></a>00056     &lt;state name=<span class="stringliteral">&quot;TryingToLogin&quot;</span>&gt;
<a name="l00057"></a>00057       &lt;!-- TryingToLogin onEntry --&gt;
<a name="l00058"></a>00058       &lt;onEntry&gt;
<a name="l00059"></a>00059         &lt;action&gt;view.loginButton-&gt;setEnabled(<span class="keyword">false</span>);&lt;/action&gt;
<a name="l00060"></a>00060         &lt;action&gt;view.logoutButton-&gt;setEnabled(<span class="keyword">false</span>);&lt;/action&gt;
<a name="l00061"></a>00061         &lt;action&gt;view.cancelButton-&gt;setEnabled(<span class="keyword">true</span>);&lt;/action&gt;
<a name="l00062"></a>00062         &lt;action&gt;loginMvc.login();&lt;/action&gt;
<a name="l00063"></a>00063         &lt;timerStart timer=<span class="stringliteral">&quot;TimerLogin&quot;</span> duration=<span class="stringliteral">&quot;loginMvc.getLoginTimeout()&quot;</span>/&gt;
<a name="l00064"></a>00064       &lt;/onEntry&gt;
<a name="l00065"></a>00065       &lt;!-- TryingToLogin onExit --&gt;
<a name="l00066"></a>00066       &lt;onExit&gt;
<a name="l00067"></a>00067         &lt;timerStop timer=<span class="stringliteral">&quot;TimerLogin&quot;</span>/&gt;
<a name="l00068"></a>00068       &lt;/onExit&gt;
<a name="l00069"></a>00069       &lt;!-- TryingToLogin transitions --&gt;
<a name="l00070"></a>00070       &lt;!-- transition triggered the push button Ok --&gt;
<a name="l00071"></a>00071       &lt;transition <span class="keyword">event</span>=<span class="stringliteral">&quot;evCancelLogin&quot;</span> nextState=<span class="stringliteral">&quot;LoginCancelled&quot;</span> /&gt;
<a name="l00072"></a>00072 
<a name="l00073"></a>00073       &lt;!-- transition triggered on timer <span class="keyword">event</span>--&gt;
<a name="l00074"></a>00074       &lt;transition <span class="keyword">event</span>=<span class="stringliteral">&quot;evTimerLogin&quot;</span> nextState=<span class="stringliteral">&quot;LoginTimeout&quot;</span>/&gt;
<a name="l00075"></a>00075       &lt;!-- transition triggered but the model--&gt;
<a name="l00076"></a>00076       &lt;transition <span class="keyword">event</span>=<span class="stringliteral">&quot;evLoginComplete&quot;</span> condition=<span class="stringliteral">&quot;success == true&quot;</span> nextState=<span class="stringliteral">&quot;LoggedIn&quot;</span>/&gt;
<a name="l00077"></a>00077       &lt;transition <span class="keyword">event</span>=<span class="stringliteral">&quot;evLoginComplete&quot;</span> nextState=<span class="stringliteral">&quot;LoginError&quot;</span>/&gt;
<a name="l00078"></a>00078     &lt;/state&gt;
<a name="l00079"></a>00079     &lt;!-- LoggedIn --&gt;
<a name="l00080"></a>00080     &lt;state name=<span class="stringliteral">&quot;LoggedIn&quot;</span>&gt;
<a name="l00081"></a>00081       &lt;onEntry action=<span class="stringliteral">&quot;view.notifyLogin();&quot;</span>/&gt;
<a name="l00082"></a>00082       &lt;transition <span class="keyword">event</span>=<span class="stringliteral">&quot;evIntentContinue&quot;</span> nextState=<span class="stringliteral">&quot;Active&quot;</span>/&gt;
<a name="l00083"></a>00083     &lt;/state&gt;    
<a name="l00084"></a>00084     &lt;!-- Active --&gt;
<a name="l00085"></a>00085     &lt;state name=<span class="stringliteral">&quot;Active&quot;</span>&gt;
<a name="l00086"></a>00086       &lt;onEntry&gt;
<a name="l00087"></a>00087         &lt;action&gt;view.loginButton-&gt;setEnabled(<span class="keyword">false</span>);&lt;/action&gt;
<a name="l00088"></a>00088         &lt;action&gt;view.logoutButton-&gt;setEnabled(<span class="keyword">true</span>);&lt;/action&gt;
<a name="l00089"></a>00089         &lt;action&gt;view.cancelButton-&gt;setEnabled(<span class="keyword">false</span>);&lt;/action&gt;
<a name="l00090"></a>00090       &lt;/onEntry&gt;
<a name="l00091"></a>00091       &lt;transition <span class="keyword">event</span>=<span class="stringliteral">&quot;evIntentLogout&quot;</span> nextState=<span class="stringliteral">&quot;Idle&quot;</span>/&gt;
<a name="l00092"></a>00092     &lt;/state&gt;
<a name="l00093"></a>00093 
<a name="l00094"></a>00094     &lt;state name=<span class="stringliteral">&quot;TopError&quot;</span>&gt;
<a name="l00095"></a>00095       &lt;transition <span class="keyword">event</span>=<span class="stringliteral">&quot;evIntentContinue&quot;</span> nextState=<span class="stringliteral">&quot;Idle&quot;</span>/&gt;
<a name="l00096"></a>00096       &lt;!-- LoginCancelled --&gt;
<a name="l00097"></a>00097       &lt;state name=<span class="stringliteral">&quot;LoginCancelled&quot;</span>&gt;
<a name="l00098"></a>00098         &lt;onEntry action=<span class="stringliteral">&quot;view.notifyCancel();&quot;</span>/&gt;
<a name="l00099"></a>00099       &lt;/state&gt;
<a name="l00100"></a>00100       &lt;!-- LoginTimeout --&gt;
<a name="l00101"></a>00101       &lt;state name=<span class="stringliteral">&quot;LoginTimeout&quot;</span>&gt;
<a name="l00102"></a>00102         &lt;onEntry action=<span class="stringliteral">&quot;view.notifyTimeout();&quot;</span>/&gt;
<a name="l00103"></a>00103       &lt;/state&gt;
<a name="l00104"></a>00104       &lt;!-- LoginError --&gt;
<a name="l00105"></a>00105       &lt;state name=<span class="stringliteral">&quot;LoginError&quot;</span>&gt;
<a name="l00106"></a>00106         &lt;onEntry action=<span class="stringliteral">&quot;view.notifyError();&quot;</span>/&gt;
<a name="l00107"></a>00107       &lt;/state&gt;
<a name="l00108"></a>00108     &lt;/state&gt;
<a name="l00109"></a>00109     &lt;!-- End --&gt;
<a name="l00110"></a>00110     &lt;state name=<span class="stringliteral">&quot;End&quot;</span> kind=<span class="stringliteral">&quot;final&quot;</span>&gt;
<a name="l00111"></a>00111     &lt;/state&gt;
<a name="l00112"></a>00112   &lt;/state&gt;
<a name="l00113"></a>00113 &lt;/sm:StateMachine&gt;
<a name="l00114"></a>00114 
</pre></div></div>
</div>
﻿<div id="footer">
    <hr />
    <p>
        Copyright &copy; 2011 StateForge.</p>
    <hr />
</div>
</body> </html> 
